<template>
    <el-scrollbar height="84vh">
        <ul>
            <li v-for="(u,index) in users" class="everyFocus" @click="turnOtherCenter(users[index].idol.id)">
                <el-link underline="never">
                    <el-image :src="u.imgSrc" class="userImg"></el-image>
                </el-link>
                <el-link underline="never" class="userName">
                    <h3>{{ u.idol.nickname }}</h3>
                </el-link>
                <p>{{ u.idol.bio }}</p>

            </li>
        </ul>
    </el-scrollbar>
</template>

<script setup lang="ts">
import { User } from '@element-plus/icons-vue';
import axios from 'axios';
import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router';



const router = useRouter()
// 获取我的关注列表
getIdolList()
async function getIdolList(){
await axios({
url:'/api/society/getIdolList',
headers: { 'Content-Type': 'application/json' }
}).then(res=>{
Object.assign(users,res.data.data)
console.log(users[0].idol)
})
}

interface user {
    id:string,
    nickname: string,
    bio: string,
    imgSrc: string,
    idol:{bio:string,id:string,nickname:string,status:string}
}
let users: user[] = reactive([])






// 点击关注列表跳转到其对应用户的用户中心
function turnOtherCenter(au:string){
    router.push({
        path:'/othercenter',
        query:{au}
    })
}




</script>


  
<style scoped>
.everyFocus {
    position: relative;
    width: 90%;
    height: 100px;
    background-color: #fff;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.everyFocus:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.userName {
    position: absolute;
    top: 10px;
    left: 105px;
    color: black;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.everyFocus:hover .userName {
    color: #FF8C42;
}

.userImg {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin-left: 16px;
    margin-top: 16px;
    object-fit: cover;
    border: 2px solid #FF6B35;
    transition: all 0.3s ease;
}

.everyFocus:hover .userImg {
    transform: scale(1.05);
    border-color: #FF8C42;
}



.everyFocus p {
    position: absolute;
    display: inline-block;
    top: 56px;
    left: 105px;
    color: #666;
    font-size: 14px;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.everyFocus:hover p {
    color: #FF6B35;
}

ul {
    margin: 0;
    padding: 0;
}

ul li {
    display: inline-block;
    list-style: none;
}
</style>
